﻿//#include<iostream>
//using namespace std;
//
////class Date
////{
////public:
////	void Init(int year, int month, int day)
////	{
////		_year = year;
////		_month = month;
////		_day = day;
////	}
////	//void Print(Data* const this)
////	void Print()
////	{
////		//cout << this->_year << "-" << this->_month << "-" << this->_day << endl;
////		cout << _year << "-" << _month << "-" << _day << endl;
////	}
////private:
////	int _year;    //年
////	int _month;   //月
////	int _day;     //日
////};
////
////// this 指向对象 访问成员变量
////
////int main()
////{
////	Date d1, d2;
////	d1.Init(2022, 1, 11);
////	d2.Init(2022, 1, 12);
////	// 明明 调用函数地址相同 打印不同值的原因
////	// 隐含的 this 指针
////	// 注释的部分就是编译器处理
////	//d1.Print(&d1);
////	d1.Print();
////
////	//d2.Print(&d2);
////	d2.Print();
////
////	return 0;
////}
//
//
//
////// 1.下面程序编译运行结果是？ A、编译报错 B、运行崩溃 C、正常运行
//// // C
////class A
////{
////public:
////	void Print()
////	{
////		cout << this << endl;
////		cout << "Print()" << endl;
////	}
////private:
////	int _a;
////};
////
////int main()
////{
////	//A* p = nullptr;
////
////	A aa;
////	A* p = & aa;
////	p->Print();
////	return 0;
////}
//
//
////// 2 下面程序编译运行结果是？ A、编译报错 B、运行崩溃 C、正常运行
////// B
////class A
////{
////public:
////	void PrintA()
////	{
////		cout << this << endl;
////		 //实际 是到 this ->_a 上面去找 但是我们从上面易知this指向空
////		cout << _a << endl;
////	}
////private:
////	int _a;
////};
////int main()
////{
////	A* p = nullptr;
////	p->PrintA();
////	return 0;
////}
//
//
//
//#include <iostream>
//using namespace std;
//
//class People {
//public:
//	int age = 18;
//	void show(int age);
//};
//
//
////People();
////~People();
////People::People(){}
////
////People::~People(){}
//
//void People::show(int age)
//{
//	//this->age = age;
//	//分别显示参数里的age 的值，再显示 成员变量age的值
//	cout << "hello " << age << " " << this->age;
//}
//
//class one {
//private:
//	string s;
//	int a;
//public:
//	void S(string s)
//	{
//		this->s = s;
//	}
//	void A(int a)
//	{
//		this->a = a;
//	}
//};
//
//
//class Person {
//private:
//	string name;
//public:
//	void Hello() {
//		cout << "Hello，my name is " << this->name << endl;
//	}
//	void setName(string name) {
//		this->name = name;
//	}
//};
//
//class Student {
//public:
//	Student* newInstance() {
//		return this;
//	}
//	void Year() {
//		cout << "The student is Young." << endl;
//	}
//};
//
//int main()
//{
//	People P;
//	int age;
//	cin >> age;
//	P.show(age);
//	cout << endl;
//	Person p;
//	p.Hello();
//
//
//	return 0;
//}
//
//
//
